try:
    f1=open("1.png", "rb") # 二进制打开文件
except Exception as e:
    print(e)
else:
    f2=open("2.png","ab") # 二进制读取文件
    while True:
        data=f1.read(1024)
        if not data:
            break
        f2.write(data)
    f1.close()
    f2.close()
